/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import LN.CControladorInstancias;
import LN.COperacionesProfesores;
import java.util.Date;
import javax.swing.JOptionPane;

/**
 *
 * @author HELIOS
 */
public class FRegistroProfesores extends javax.swing.JInternalFrame {

    /**
     * Creates new form FRegistroProfesores
     */
    public FRegistroProfesores() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BGGenero = new javax.swing.ButtonGroup();
        BGEstadoCivil = new javax.swing.ButtonGroup();
        PPrincipal = new javax.swing.JPanel();
        TBEmailCorporativo = new javax.swing.JTextField();
        TBLugarNaciimiento = new javax.swing.JTextField();
        LLugarNacimiento = new javax.swing.JLabel();
        BReiniciar = new javax.swing.JButton();
        LCiudad = new javax.swing.JLabel();
        TBBarrioResidencia = new javax.swing.JTextField();
        RBMasculino = new javax.swing.JRadioButton();
        TBCiudadResidencia = new javax.swing.JTextField();
        LDireccion = new javax.swing.JLabel();
        TBPensiones = new javax.swing.JTextField();
        LPrimerApellido = new javax.swing.JLabel();
        LPensiones = new javax.swing.JLabel();
        LExpDoc = new javax.swing.JLabel();
        TBPrimerApellido = new javax.swing.JTextField();
        TBSegundoApellido = new javax.swing.JTextField();
        LNumDoc = new javax.swing.JLabel();
        TBExpDoc = new javax.swing.JTextField();
        TBeps = new javax.swing.JTextField();
        TBTelefono2 = new javax.swing.JTextField();
        TBCelular = new javax.swing.JTextField();
        CBTipoDoc = new javax.swing.JComboBox();
        LEPS = new javax.swing.JLabel();
        TBTelefono1 = new javax.swing.JTextField();
        LTelefono1 = new javax.swing.JLabel();
        LTelefono2 = new javax.swing.JLabel();
        LEmailPersonal = new javax.swing.JLabel();
        TBEmailPersonal = new javax.swing.JTextField();
        LTelefono3 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        LTipoDoc = new javax.swing.JLabel();
        LBarrio = new javax.swing.JLabel();
        TBNumDoc = new javax.swing.JTextField();
        TBLibretaMilitar = new javax.swing.JTextField();
        PEstadoCivil = new javax.swing.JPanel();
        RBSoltero = new javax.swing.JRadioButton();
        RBCasado = new javax.swing.JRadioButton();
        RBUnionLibre = new javax.swing.JRadioButton();
        RBDivorciado = new javax.swing.JRadioButton();
        RBViudo = new javax.swing.JRadioButton();
        RBOtro = new javax.swing.JRadioButton();
        TBNombreCompleto = new javax.swing.JTextField();
        LSegundoApellido = new javax.swing.JLabel();
        TBDirResidencia = new javax.swing.JTextField();
        LNombreCompleto = new javax.swing.JLabel();
        RBFemenino = new javax.swing.JRadioButton();
        LGenero = new javax.swing.JLabel();
        BSiguiente = new javax.swing.JButton();
        LEmailCorporativo = new javax.swing.JLabel();
        DTFechaNac = new com.toedter.calendar.JDateChooser();
        LFechaNacimiento = new javax.swing.JLabel();
        LLibretaMilitar = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setClosable(true);
        setTitle("Registro de Profesores");
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameClosed(evt);
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
        });

        LLugarNacimiento.setText("Lugar de nacimiento");

        BReiniciar.setText("Reiniciar");
        BReiniciar.setName("BReiniciar");
        BReiniciar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BReiniciarActionPerformed(evt);
            }
        });

        LCiudad.setText("Ciudad");

        BGGenero.add(RBMasculino);
        RBMasculino.setSelected(true);
        RBMasculino.setText("M");
        RBMasculino.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBMasculinoActionPerformed(evt);
            }
        });

        LDireccion.setText("Dirección de residencia");

        LPrimerApellido.setText("Primer Apellido");

        LPensiones.setText("Pensiones");

        LExpDoc.setText("De");

        LNumDoc.setText("No.");

        TBCelular.setName("TBCelular");

        CBTipoDoc.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "CC", "CE", "NIT", "Pasaporte", "TI", " " }));

        LEPS.setText("EPS");

        LTelefono1.setText("Teléfono 1");

        LTelefono2.setText("Teléfono 2");

        LEmailPersonal.setText("E-mail personal");

        LTelefono3.setText("Celular");
        LTelefono3.setName("LCelular");

        jLabel1.setText("Estado Civil");

        LTipoDoc.setText("Documento");

        LBarrio.setText("Barrio");

        TBNumDoc.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                TBNumDocFocusLost(evt);
            }
        });

        BGEstadoCivil.add(RBSoltero);
        RBSoltero.setSelected(true);
        RBSoltero.setText("Soltero(a)");

        BGEstadoCivil.add(RBCasado);
        RBCasado.setText("Casado(a)");

        BGEstadoCivil.add(RBUnionLibre);
        RBUnionLibre.setText("Unión Libre");

        BGEstadoCivil.add(RBDivorciado);
        RBDivorciado.setText("Divorciado(a)");

        BGEstadoCivil.add(RBViudo);
        RBViudo.setText("Viudo(a)");

        BGEstadoCivil.add(RBOtro);
        RBOtro.setText("Otro");

        javax.swing.GroupLayout PEstadoCivilLayout = new javax.swing.GroupLayout(PEstadoCivil);
        PEstadoCivil.setLayout(PEstadoCivilLayout);
        PEstadoCivilLayout.setHorizontalGroup(
            PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PEstadoCivilLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBSoltero)
                    .addComponent(RBDivorciado))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                .addGroup(PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBCasado)
                    .addComponent(RBViudo))
                .addGap(38, 38, 38)
                .addGroup(PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(RBOtro)
                    .addComponent(RBUnionLibre))
                .addContainerGap())
        );
        PEstadoCivilLayout.setVerticalGroup(
            PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PEstadoCivilLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RBSoltero)
                    .addComponent(RBCasado)
                    .addComponent(RBUnionLibre))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PEstadoCivilLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RBViudo)
                    .addComponent(RBDivorciado)
                    .addComponent(RBOtro))
                .addGap(23, 23, 23))
        );

        LSegundoApellido.setText("Segundo Apellido");

        LNombreCompleto.setText("Nombre Completo");

        BGGenero.add(RBFemenino);
        RBFemenino.setText("F");
        RBFemenino.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBFemeninoActionPerformed(evt);
            }
        });

        LGenero.setText("Género");

        BSiguiente.setText("Siguiente");
        BSiguiente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BSiguienteActionPerformed(evt);
            }
        });

        LEmailCorporativo.setText("E-mail corporativo");

        DTFechaNac.setDateFormatString("dd/MM/yyyy");

        LFechaNacimiento.setText("Fecha de nacimiento");

        LLibretaMilitar.setText("Libreta Militar Número");

        javax.swing.GroupLayout PPrincipalLayout = new javax.swing.GroupLayout(PPrincipal);
        PPrincipal.setLayout(PPrincipalLayout);
        PPrincipalLayout.setHorizontalGroup(
            PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(TBCelular, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
                                        .addComponent(TBeps))
                                    .addComponent(LTelefono3))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(LPensiones)
                                    .addComponent(LEmailCorporativo)
                                    .addGroup(PPrincipalLayout.createSequentialGroup()
                                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(TBPensiones, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)
                                            .addComponent(TBEmailCorporativo))
                                        .addGap(79, 79, 79)
                                        .addComponent(BReiniciar)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(BSiguiente))))
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addComponent(LEPS)
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap(83, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(CBTipoDoc, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(LTipoDoc))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(TBNumDoc, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(LNumDoc))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(LExpDoc)
                                    .addComponent(TBExpDoc, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(PPrincipalLayout.createSequentialGroup()
                                        .addGap(1, 1, 1)
                                        .addComponent(TBPrimerApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(LPrimerApellido)
                                    .addComponent(TBLugarNaciimiento, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(LLugarNacimiento))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(LFechaNacimiento)
                                    .addComponent(DTFechaNac, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(TBSegundoApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(LSegundoApellido))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(TBNombreCompleto, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(LNombreCompleto))
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(PPrincipalLayout.createSequentialGroup()
                                        .addGap(12, 12, 12)
                                        .addComponent(jLabel1))
                                    .addGroup(PPrincipalLayout.createSequentialGroup()
                                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                                .addComponent(RBMasculino)
                                                .addGap(18, 18, 18)
                                                .addComponent(RBFemenino))
                                            .addComponent(LGenero))
                                        .addGap(18, 18, 18)
                                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(LLibretaMilitar)
                                            .addComponent(TBLibretaMilitar, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(TBEmailPersonal)
                                        .addGroup(PPrincipalLayout.createSequentialGroup()
                                            .addComponent(LEmailPersonal)
                                            .addGap(267, 267, 267)))
                                    .addGroup(PPrincipalLayout.createSequentialGroup()
                                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(TBTelefono1, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(LTelefono1))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(LTelefono2)
                                            .addComponent(TBTelefono2, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addContainerGap())))
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(TBDirResidencia, javax.swing.GroupLayout.PREFERRED_SIZE, 392, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(LDireccion)
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(TBBarrioResidencia, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(LBarrio))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(LCiudad)
                                    .addComponent(TBCiudadResidencia))))
                        .addGap(45, 45, 45)
                        .addComponent(PEstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(14, Short.MAX_VALUE))))
        );
        PPrincipalLayout.setVerticalGroup(
            PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LNombreCompleto)
                    .addComponent(LSegundoApellido, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(LPrimerApellido))
                .addGap(3, 3, 3)
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TBNombreCompleto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TBSegundoApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TBPrimerApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(9, 9, 9)
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LTipoDoc)
                            .addComponent(LNumDoc)
                            .addComponent(LExpDoc))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TBNumDoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TBExpDoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CBTipoDoc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LGenero)
                            .addComponent(LLibretaMilitar))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(RBMasculino)
                            .addComponent(RBFemenino)
                            .addComponent(TBLibretaMilitar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGap(63, 63, 63)
                        .addComponent(LDireccion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(TBDirResidencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PPrincipalLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(LLugarNacimiento)
                                .addComponent(LFechaNacimiento))
                            .addComponent(jLabel1))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PPrincipalLayout.createSequentialGroup()
                                .addComponent(PEstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(19, 19, 19))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PPrincipalLayout.createSequentialGroup()
                                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(DTFechaNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(TBLugarNaciimiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(57, 57, 57)))))
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PPrincipalLayout.createSequentialGroup()
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LCiudad)
                            .addComponent(LTelefono1)
                            .addComponent(LTelefono2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TBBarrioResidencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TBCiudadResidencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TBTelefono1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TBTelefono2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PPrincipalLayout.createSequentialGroup()
                        .addComponent(LBarrio)
                        .addGap(29, 29, 29)))
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LEmailPersonal)
                            .addComponent(LEmailCorporativo)))
                    .addComponent(LTelefono3, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TBEmailCorporativo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TBCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TBEmailPersonal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(LPensiones))
                    .addGroup(PPrincipalLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LEPS)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TBeps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TBPensiones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BReiniciar)
                            .addComponent(BSiguiente))))
                .addContainerGap(75, Short.MAX_VALUE))
        );

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/fundacion.png"))); // NOI18N

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/profesor.jpg"))); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(PPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel3)
                .addGap(91, 91, 91))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formInternalFrameClosed(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosed
        // TODO add your handling code here:
        CControladorInstancias.cerrarVentanaRegP();
    }//GEN-LAST:event_formInternalFrameClosed

    private void BReiniciarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BReiniciarActionPerformed
        limpiar();
    }//GEN-LAST:event_BReiniciarActionPerformed

    private void BSiguienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BSiguienteActionPerformed
        if (validar()) {
            String tipoDoc, numDoc, lugExp, apellido1, apellido2, nombre, estadoCivil,
                    genero, libretaMilitar, lugNac, fondoPens, EPS, direccion, barrio,
                    ciudad, tel1, tel2, celular, emailInstitucional, emailPersonal;
            Date fechaNac;
            libretaMilitar = "";
            int opt = JOptionPane.showConfirmDialog(this, "Desea guardar los cambios?");
            switch (opt) {
                case 0:
                    tipoDoc = CBTipoDoc.getSelectedItem().toString();
                    numDoc = TBNumDoc.getText();
                    lugExp = TBLugarNaciimiento.getText();
                    apellido1 = TBPrimerApellido.getText();
                    apellido2 = TBSegundoApellido.getText();
                    nombre = TBNombreCompleto.getText();

                    if (RBSoltero.isSelected()) {
                        estadoCivil = RBSoltero.getText();
                    } else if (RBCasado.isSelected()) {
                        estadoCivil = RBCasado.getText();
                    } else if (RBUnionLibre.isSelected()) {
                        estadoCivil = RBUnionLibre.getText();
                    } else if (RBDivorciado.isSelected()) {
                        estadoCivil = RBDivorciado.getText();
                    } else if (RBViudo.isSelected()) {
                        estadoCivil = RBViudo.getText();
                    } else {
                        estadoCivil = RBOtro.getText();
                    }

                    if (RBMasculino.isSelected()) {
                        genero = "Masculino";
                    } else {
                        genero = "Femenino";
                    }
                    if (genero.equals("Masculino")) {
                        libretaMilitar = TBLibretaMilitar.getText();
                    }
                    lugNac = TBLugarNaciimiento.getText();
                    fechaNac = DTFechaNac.getDate();
                    fondoPens = TBPensiones.getText();
                    EPS = TBeps.getText();
                    direccion = TBDirResidencia.getText();
                    ciudad = TBCiudadResidencia.getText();
                    barrio = TBBarrioResidencia.getText();
                    tel1 = TBTelefono2.getText();
                    tel2 = TBTelefono1.getText();
                    celular = TBCelular.getText();
                    emailInstitucional = TBEmailCorporativo.getText();
                    emailPersonal = TBEmailPersonal.getText();
                    if (genero.equals("Masculino")) {
                        try {
                            COperacionesProfesores.RegistrarProfesorM(tipoDoc, numDoc, lugExp, apellido1, apellido2, nombre, estadoCivil, genero, libretaMilitar, fechaNac, lugNac, fondoPens, EPS, direccion, barrio, ciudad, tel1, tel2, celular, emailInstitucional, emailPersonal);
                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(this, ex.getMessage());
                        }
                    } else {
                        try {
                            COperacionesProfesores.RegistrarProfesorF(tipoDoc, numDoc, lugExp, apellido1, apellido2, nombre, estadoCivil, genero, fechaNac, lugNac, fondoPens, EPS, direccion, barrio, ciudad, tel1, tel2, celular, emailInstitucional, emailPersonal);
                        } catch (Exception ex) {
                            JOptionPane.showMessageDialog(this, ex.getMessage());
                        }
                    }
                    break;
                case 1:
                    this.dispose();
                    CControladorInstancias.cerrarVentanaRegP();
                    break;
                case 2:
                    JOptionPane.showMessageDialog(this, "Cancelar");
                    break;
            }
        }
    }//GEN-LAST:event_BSiguienteActionPerformed

    private void TBNumDocFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_TBNumDocFocusLost
        if (COperacionesProfesores.existeProfesor(TBNumDoc.getText())) {
            JOptionPane.showMessageDialog(this, "El profesor ya se encuentra registrado en el sistema");
            limpiar();
            TBPrimerApellido.grabFocus();
        }
    }//GEN-LAST:event_TBNumDocFocusLost

    private void RBMasculinoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBMasculinoActionPerformed
        TBLibretaMilitar.setEnabled(true);
        LLibretaMilitar.setEnabled(true);
    }//GEN-LAST:event_RBMasculinoActionPerformed

    private void RBFemeninoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBFemeninoActionPerformed
        // TODO add your handling code here:
        TBLibretaMilitar.setEnabled(false);
        LLibretaMilitar.setEnabled(false);
    }//GEN-LAST:event_RBFemeninoActionPerformed

    private void limpiar() {
        TBPrimerApellido.setText("");
        TBSegundoApellido.setText("");
        TBNombreCompleto.setText("");
        TBNumDoc.setText("");
        TBExpDoc.setText("");
        TBLibretaMilitar.setText("");
        TBLugarNaciimiento.setText("");
        DTFechaNac.cleanup();
        RBMasculino.setSelected(true);
        RBSoltero.setSelected(true);
        TBDirResidencia.setText("");
        TBBarrioResidencia.setText("");
        TBCiudadResidencia.setText("");
        TBTelefono1.setText("");
        TBTelefono2.setText("");
        TBCelular.setText("");
        TBEmailCorporativo.setText("");
        TBEmailPersonal.setText("");
        TBPensiones.setText("");
        TBeps.setText("");
        TBPrimerApellido.grabFocus();
    }

    private boolean validar() {
        boolean flag = true;
        if (TBPrimerApellido.getText().isEmpty()) {
            TBPrimerApellido.requestFocus();
            flag = false;
        } else if (TBSegundoApellido.getText().isEmpty()) {
            TBSegundoApellido.requestFocus();
            flag = false;
        } else if (TBNombreCompleto.getText().isEmpty()) {
            TBNombreCompleto.requestFocus();
            flag = false;
        } else if (TBNumDoc.getText().isEmpty()) {
            TBNumDoc.requestFocus();
            flag = false;
        } else if (TBExpDoc.getText().isEmpty()) {
            TBExpDoc.requestFocus();
            flag = false;
        } else if (TBLugarNaciimiento.getText().isEmpty()) {
            TBLugarNaciimiento.requestFocus();
            flag = false;
        } else if (DTFechaNac.getDate().toString().isEmpty()) {
            DTFechaNac.requestFocus();
            flag = false;
        } else if (TBDirResidencia.getText().isEmpty()) {
            TBDirResidencia.requestFocus();
            flag = false;
        } else if (TBBarrioResidencia.getText().isEmpty()) {
            TBBarrioResidencia.requestFocus();
            flag = false;
        } else if (TBCiudadResidencia.getText().isEmpty()) {
            TBCiudadResidencia.requestFocus();
            flag = false;
        } else if (TBTelefono1.getText().isEmpty()) {
            TBTelefono1.requestFocus();
            flag = false;
        } else if (TBTelefono2.getText().isEmpty()) {
            TBTelefono2.requestFocus();
            flag = false;
        } else if (TBCelular.getText().isEmpty()) {
            TBCelular.requestFocus();
            flag = false;
        } else if (TBEmailPersonal.getText().isEmpty()) {
            TBCelular.requestFocus();
            flag = false;
        } else if (TBEmailCorporativo.getText().isEmpty()) {
            TBEmailCorporativo.requestFocus();
            flag = false;
        } else if (TBPensiones.getText().isEmpty()) {
            TBPensiones.requestFocus();
            flag = false;
        } else if (TBeps.getText().isEmpty()) {
            TBeps.requestFocus();
            flag = false;
        } else {
            if (RBMasculino.isSelected()) {
                if (TBLibretaMilitar.getText().isEmpty()) {
                    TBLibretaMilitar.requestFocus();
                    flag = false;
                }
            }
        }
        return flag;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup BGEstadoCivil;
    private javax.swing.ButtonGroup BGGenero;
    private javax.swing.JButton BReiniciar;
    private javax.swing.JButton BSiguiente;
    private javax.swing.JComboBox CBTipoDoc;
    private com.toedter.calendar.JDateChooser DTFechaNac;
    private javax.swing.JLabel LBarrio;
    private javax.swing.JLabel LCiudad;
    private javax.swing.JLabel LDireccion;
    private javax.swing.JLabel LEPS;
    private javax.swing.JLabel LEmailCorporativo;
    private javax.swing.JLabel LEmailPersonal;
    private javax.swing.JLabel LExpDoc;
    private javax.swing.JLabel LFechaNacimiento;
    private javax.swing.JLabel LGenero;
    private javax.swing.JLabel LLibretaMilitar;
    private javax.swing.JLabel LLugarNacimiento;
    private javax.swing.JLabel LNombreCompleto;
    private javax.swing.JLabel LNumDoc;
    private javax.swing.JLabel LPensiones;
    private javax.swing.JLabel LPrimerApellido;
    private javax.swing.JLabel LSegundoApellido;
    private javax.swing.JLabel LTelefono1;
    private javax.swing.JLabel LTelefono2;
    private javax.swing.JLabel LTelefono3;
    private javax.swing.JLabel LTipoDoc;
    private javax.swing.JPanel PEstadoCivil;
    private javax.swing.JPanel PPrincipal;
    private javax.swing.JRadioButton RBCasado;
    private javax.swing.JRadioButton RBDivorciado;
    private javax.swing.JRadioButton RBFemenino;
    private javax.swing.JRadioButton RBMasculino;
    private javax.swing.JRadioButton RBOtro;
    private javax.swing.JRadioButton RBSoltero;
    private javax.swing.JRadioButton RBUnionLibre;
    private javax.swing.JRadioButton RBViudo;
    private javax.swing.JTextField TBBarrioResidencia;
    private javax.swing.JTextField TBCelular;
    private javax.swing.JTextField TBCiudadResidencia;
    private javax.swing.JTextField TBDirResidencia;
    private javax.swing.JTextField TBEmailCorporativo;
    private javax.swing.JTextField TBEmailPersonal;
    private javax.swing.JTextField TBExpDoc;
    private javax.swing.JTextField TBLibretaMilitar;
    private javax.swing.JTextField TBLugarNaciimiento;
    private javax.swing.JTextField TBNombreCompleto;
    private javax.swing.JTextField TBNumDoc;
    private javax.swing.JTextField TBPensiones;
    private javax.swing.JTextField TBPrimerApellido;
    private javax.swing.JTextField TBSegundoApellido;
    private javax.swing.JTextField TBTelefono1;
    private javax.swing.JTextField TBTelefono2;
    private javax.swing.JTextField TBeps;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration//GEN-END:variables
}
